#include "stdafx.h"
#include "GameMusic.h"
#include "windows.h"
#include "Mmsystem.h"
SINGLETON_IMPL(GameMusic)

GameMusic::GameMusic(void)
{
	m_background = m_music = TRUE;
}

GameMusic::~GameMusic(void)
{
}
void GameMusic::Init()
{
	HMIDIIN  handle;
	MMRESULT result = midiInOpen(&handle,0,0,0,CALLBACK_NULL);
	if (result == MMSYSERR_NOERROR) {
		
	}
}
void GameMusic::Play(MUSIC_FILE type)
{
	if (!m_music) {
		return;
	}
	switch (type){
		case MUSIC_SELECTED:
			PlaySound(L"midi\\selected.wav",NULL,SND_FILENAME|SND_ASYNC);
			break;
		case MUSIC_FAILED:
			PlaySound(L"midi\\failed.wav",NULL,SND_FILENAME|SND_ASYNC);
			break;
		case MUSIC_SUCCESS:
			PlaySound(L"midi\\success.wav",NULL,SND_FILENAME|SND_ASYNC);
			break;
		case MUSIC_BACKGROUND:
			//PlaySound(L"midi\\background.mid",NULL,SND_FILENAME|SND_ASYNC);
			
			//midiInStart();
			break;
		default:
			break;
	}
}
